// 请求通用方法
import apiMixin from '@/mixin/apiMixin';
// 任务通用方法
import taskMixin from '@/mixin/taskMixin';
export default {
    mixins: [apiMixin,taskMixin],
    data() {
        return {
            loading: false,
            tableData: [],
            arnShow:false,
            searchTypeList: [
                { value: "user_id", name: "用户ID" },
                { value: "1", name: "重复上传截图" },
                { value: "2", name: "5秒内提交截图" },
                { value: "3", name: "举报超过5次" },
                { value: "4", name: "地址和手机异地" },
                { value: "5", name: "重复设备号" },
                { value: "6", name: "涉嫌花呗套现" },
                { value: "7", name: "已被封禁用户" },
                { value: "8", name: "使用模拟器用户" }
            ],
            searchType: 'user_id',
            searchText: '',
            listNumsTotal: 0,
            curHandleIndex: 0,
            userAbNomalList: [],
            curPage: 1,
            disBtnLoad: false,
            status: [
                {
                    text: '未处理',
                    value: '0'
                },
                {
                    text: '已处理',
                    value: '1'
                },
            ]
        }
    },
    mounted() {
        if (  this.filterStatus == 0 || this.filterStatus ) {
            this.$refs.filterTable.columns[6].filteredValue = this.filterStatus.split(',');
        }
        this.init();
    },
    methods: {
        init() {
            this.getAbnormalListApi(this.curPage);
        },
        getAbnormalListApi(page) {
            let _self = this;
            this.comResquest(this.request.getAbnormalList,(res)=>{
                console.log(res);
                _self.curPage = Number(page) || 1;
                _self.updateRoutePar(page);
                let { count,result } = res;
                _self.listNumsTotal = count;
                _self.tableData = result;
            },{
                page,
                load: true,
                type: this.searchType,
                keyword: this.searchText,
                status: this.filterStatus
            });
        },
        getAbnormalListByIdApi() {
            let _self = this;
            let curObj = this.tableData[this.curHandleIndex];
            this.comResquest(this.request.getAbnormalList,(res)=>{
                _self.userAbNomalList = res.result;
                _self.handlePop();
            },{
                load: true,
                type: 'detail_user',
                keyword: curObj.user_id,
                pagesize: curObj.abnormal_deal
            });
        },
        postDisposeAbnormalApi() {
            let _self = this;
            let curObj = this.tableData[this.curHandleIndex];
            this.comResquest(this.request.postDisposeAbnormal,(res)=>{
                _self.handlePop();
                _self.init();
            },{
                id: curObj.user_id,
                load: "disBtnLoad",
            });
        },
        searchWill() {
            this.getAbnormalListApi();
        },
        changePage(page) {
            page = page || 1;
            this.getAbnormalListApi(page);
        },
        handlePop() {
            this.arnShow = !this.arnShow;
        },
        popOpenDid() {
            this.$refs.popScroll.scrollTop = 0;
        },
        checkAbl(ablIndex) {
            this.curHandleIndex = ablIndex;
            this.getAbnormalListByIdApi();
        },
        handleFilter(e) {
            this.filterStatus = e.status.join(',');
            this.getAbnormalListApi(1);
        }
    },
}